// interface Parent {
//   name: string;
// }
// interface Son extends Parent {
//   cry(): void;
// }
// function play(parent: Parent) {
//   (parent as Son).cry();
// }
// let parentObj: Parent = { name: "你好" };
// play(parentObj);

function getCacheData(key: string): any {
  return (window as any).cache[key];
}

interface Cat {
  name: string;
  run(): void;
}
const tom: Cat = getCacheData("tom");
tom.run();

type Method = "get" | "post";
function request(url: string, method: Method) {
  if (method === "get") {
    console.log(method, url);
  } else if (method === "post") {
    console.log(method, url);
  } else {
    console.log(method);
  }
}
